package li.webqq.api;

import li.http.Request;
import li.webqq.Const;

import org.apache.log4j.Logger;

/**
 * @author 明伟
 */
public class CheckRequest extends Request implements Const {
    private static final Logger logger = Logger.getLogger(CheckRequest.class);

    private String uin;

    public void setUin(String uin) {
        this.uin = uin;
    }

    public CheckResponse execute() {
        logger.info("CheckRequest execute");

        setReferer("https://ui.ptlogin2.qq.com/cgi-bin/login"//
                + "?daid=164"//
                + "&target=self"//
                + "&style=16"//
                + "&mibao_css=m_webqq"//
                + "&appid=501004106"//
                + "&enable_qlogin=0"//
                + "&no_verifyimg=1"//
                + "&s_url=http%3A%2F%2Fw.qq.com%2Fproxy.html"//
                + "&f_url=loginerroralert"//
                + "&strong_login=1"//
                + "&login_state=10"//
                + "&t=20131024001");

        setUrl("https://ssl.ptlogin2.qq.com/check"//
                + "?uin=" + uin//
                + "&appid=1003903"//
                + "&js_ver=10038"//
                + "&js_type=0"//
                + "&login_sig={1}"//
                + "&u1=http%3A%2F%2Fweb2.qq.com%2Floginproxy.html"//
                + "&r={2}");

        setCookies("lv_irt_id=3af0ddd2834c932ffbc47e96e8a5fad2;"//
                + " _gscu_661903259=9471204631our123;"//
                + " webwxuvid=1031805353;"//
                + " RK=5DOnNRVU2q;"//
                + " pt2gguin=o0416133823;"//
                + " ptcz=84b9d4185b3c077b9abeb97c78bc3ee2e60c461049376807fc8f7055d10c8119;"//
                + " mm_lang=zh_CN;"//
                + " pgv_info=ssid=s3835268940;"//
                + " pgv_pvid=6395148248;"//
                + " o_cookie=416133823;"//
                + " uikey=f083e33f2abc05b12f7ee418e14dc154f204516fb389c916f71152e306b26dda;"//
                + " qrsig=5fi1ulz76S7-uu0LgCDSQMu780PNkA2ftzlN8uMVJ9*gOvfwzBdwI8HFLuQzLqhk;"//
                + " chkuin=1055515958");

        setUserAgent("Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36");

        setHeader("Accept", "*/*");
        setHeader("Accept-Encoding", "gzip,deflate,sdch");
        setHeader("Accept-Language", "zh-CN,zh;q=0.8");
        setHeader("Connection", "keep-alive");

        return super.execute(new CheckResponse());
    }
}